package com.restkeeper.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
/**
 * 文件名: WeChatConfig
 * 描述: 微信配置类
 */
@Component
@Data
public class WeChatConfig {
    /** appId */
    @Value("${weChat.appId}")
    private String appId;
    /** appSecret */
    @Value("${weChat.appSecret}")
    private String appSecret;
    /** sign_token */
    @Value("${weChat.sign_token}")
    private String sign_token;
    /** 服务器域名 */
    @Value("${weChat.server_url}")
    private String serverUrl;

    /** 商户号 */
    @Value("${weChat.merchantId}")
    private String merchantId;
    /** 商户API私钥路径 */
    @Value("${weChat.privateKeyPath}")
    private String privateKeyPath;
    /** 商户证书序列号 */
    @Value("${weChat.merchantSerialNumber}")
    private String merchantSerialNumber;
    /** 商户APIV3密钥 */
    @Value("${weChat.apiV3key}")
    private String apiV3key;
    /** 微信支付成功回调地址 */
    @Value("${weChat.notify_url}")
    private String notifyUrl;
 
    @Value("${weChat.appId}")
    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Value("${weChat.appSecret}")
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    @Value("${weChat.sign_token}")
    public void setSign_token(String sign_token) {
        this.sign_token = sign_token;
    }
    @Value("${weChat.server_url}")
    public void setServer_url(String server_url) {
        this.serverUrl = server_url;
    }

    /**
     * 1. 获取access_token.
     */
   public String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET";
//   public String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx262970a06cd8fc20&secret=e68aaa4021050d63628aa076c0fa34c5";
    /**
     * 2. 获得各种类型的ticket.
     */
    String TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=";
    /**
     * 3. 长链接转短链接接口.
     */
    String SHORTURL_API_URL = "https://api.weixin.qq.com/cgi-bin/shorturl";
    /**
     * 4. 语义查询接口.
     */
    String SEMANTIC_SEMPROXY_SEARCH_URL = "https://api.weixin.qq.com/semantic/semproxy/search";
    /**
     * 5. 用code换取oauth2的access token.
     */
    String OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
            "appid=APPID&secret=APPSECRET&code=CODE&grant_type=authorization_code";
    /**
     * 6. 刷新oauth2的access token.
     */
    String OAUTH2_REFRESH_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/refresh_token?" +
            "appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN";
    /**
     * 7. 用oauth2获取用户信息.
     */
    String OAUTH2_USERINFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=LANG";
    /**
     * 8. 验证oauth2的access token是否有效.
     */
    String OAUTH2_VALIDATE_TOKEN_URL = "https://api.weixin.qq.com/sns/auth?access_token=ACCESS_TOKEN&openid=OPENID";
    /**
     * 9. 获取微信服务器IP地址.
     */
    String CALLBACK_IP_URL = "https://api.weixin.qq.com/cgi-bin/getcallbackip";
    /**
     * 10. 第三方使用网站应用授权登录的url.
     */
    String QRCONNECT_URL = "https://open.weixin.qq.com/connect/qrconnect?" +
            "appid=APPID&redirect_uri=REDIRECT_URL&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
    /**
     * 11. oauth2授权的url连接.
     */
    String CONNECT_OAUTH2_AUTHORIZE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?" +
            "appid=APPID&redirect_uri=REDIRECT_URL&response_type=code&scope=SCOPE&" +
            "state=STATE#wechat_redirect";
 
    /**
     * 12. 获取公众号的自动回复规则.
     */
    String CURRENT_AUTOREPLY_INFO_URL = "https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info";
 
    /**
     * 13.公众号调用或第三方平台帮公众号调用对公众号的所有api调用（包括第三方帮其调用）次数进行清零.
     */
    String CLEAR_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/clear_quota";
    /**
     * 14.获取微信公众号用户的基本信息(UnionID机制)
     */
    String USERINFO_URL="https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
    /**
     * 15.生成带参数的二维码
     */
    String qrCode_URL="https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN";
    /**
     * 16.显示二维码图片的URL
     */
    String showQrCode_URL="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=TICKET";
    /**
     * 17.微信公众号长链接转短链接接口,POST请求
     */
    String shortURL="https://api.weixin.qq.com/cgi-bin/shorturl?access_token=ACCESS_TOKEN";
    /**
     * 18.自定义菜单查询接口
     */
    String findMenu_URL="https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN";
    /**
     *  19.删除自定义菜单接口
     */
    String deleteMenu_URL="https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN";
    /**
     * 20.微信 新增临时素材
     */
    String uploadTempMedia_URL="https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE";
    /**
     * 微信模板接口
     */
    String SEND_TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
}
